import request from "./request";

/** 二手闲置 */

//发布
export async function insert (param,params) {
  return await request({
    url: '/idle/insert',
    method: 'post',
    data:param,
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}


//分页查询
export async function pageIdle (param,params) {
  return await request({
    url: '/idle/page/'+param.current+'/'+param.size+'?itemsName='+param.itemsName+'&tag='+param.tag+'&sort='+param.sort,
    method: 'get',
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}

//查询详情
export async function getDetails (param,params) {
  return await request({
    url: '/idle/visit/'+param.id+'/'+params.userId,
    method: 'get',
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}

//查询历史
export async function pageIdleHistory (param,params) {
  return await request({
    url: '/idle/history/'+params.userId+'/'+param.current+'/'+param.size,
    method: 'get',
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}

//删除
export async function deleteIdle (param,params) {
  return await request({
    url: '/idle/delete/'+param.id,
    method: 'delete',
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}